home *** CD-ROM | disk | FTP | other *** search
/ Young Minds / Young Minds Interactive CD-ROM.ISO / qix / patch1 < prev    next >
Encoding:
Text File  |  1988-03-09  |  45.3 KB  |  1,520 lines

  1. #! /bin/sh
  2. # This is a shell archive.  Remove anything before this line, then unpack
  3. # it by saving it into a file and typing "sh file".  To overwrite existing
  4. # files, type "sh file -c".  You can also feed this as standard input via
  5. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  6. # will see the following message at the end:
  7. #        "End of shell archive."
  8. # Contents:  README2 Patches01
  9. # Wrapped by billr@saab on Tue Mar  8 10:36:52 1988
  10. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  11. if test -f README2 -a "${1}" != "-c" ; then 
  12.   echo shar: Will not over-write existing file \"README2\"
  13. else
  14. echo shar: Extracting \"README2\" \(733 characters\)
  15. sed "s/^X//" >README2 <<'END_OF_README2'
  16. XThe latest qix version now supports color.
  17. XThanx to:
  18. XIan Donaldson <uunet.uu.net!munnari!koel.rmit.oz.au!rcodi>
  19. X
  20. XIn addition to Ian's changes:
  21. X
  22. XNew command line option "-s timeout" where timeout is in milliseconds.
  23. XMachines with a graphics processor run significantly faster and the player
  24. Xhasn't a chance.  I've noticed that running with a gp, -s 50000 should
  25. Xbe sufficient.
  26. X
  27. XThe program has been speeded up slightly -- it was too easy.  The qix is
  28. Xmore aggressive and faster beginning at the second screen.
  29. X
  30. XThe program figures out whether you're running in color and if so, it
  31. Xwill speed up a little for those without gp's so that it runs about
  32. Xthe same speed as a sun3/50.
  33. X
  34. XThe scorefile is created if it doesn't already exist.
  35. X
  36. END_OF_README2
  37. if test 733 -ne `wc -c <README2`; then
  38.     echo shar: \"README2\" unpacked with wrong size!
  39. fi
  40. # end of overwriting check
  41. fi
  42. if test -f Patches01 -a "${1}" != "-c" ; then 
  43.   echo shar: Will not over-write existing file \"Patches01\"
  44. else
  45. echo shar: Extracting \"Patches01\" \(42908 characters\)
  46. sed "s/^X//" >Patches01 <<'END_OF_Patches01'
  47. X*** OLD/Makefile    Tue Jan 12 15:53:56 1988
  48. X--- Makefile    Mon Mar  7 21:55:35 1988
  49. X***************
  50. X*** 6,19 ****
  51. X  ICONS= joystick.lf joystick.rt joystick.up joystick.dn joystick.stop \
  52. X      spark1.pr spark2.pr spark3.pr spark4.pr marker.cursor qix.icon \
  53. X      mouse.rt.icon
  54. X  CFLAGS= -O
  55. X  LDFLAGS= 
  56. X  LIBES= -lsuntool -lsunwindow -lpixrect
  57. X  
  58. X! qix.x: ${OBJS}
  59. X      @echo loading...
  60. X      @cc ${LDFLAGS} ${OBJS} ${LIBES} -o qix
  61. X  
  62. X  # qix with a recursive polygon file rather than iterative.
  63. X  # If you use it you have to unlimit the stacksize in csh
  64. X  # and check the code to make sure it's called right (it's old).
  65. X--- 6,37 ----
  66. X  ICONS= joystick.lf joystick.rt joystick.up joystick.dn joystick.stop \
  67. X      spark1.pr spark2.pr spark3.pr spark4.pr marker.cursor qix.icon \
  68. X      mouse.rt.icon
  69. X+ 
  70. X+ #    Change these to suit your installation
  71. X+ 
  72. X+ SCOREFILE=/usr/games/lib/qix.scores
  73. X+ BINDIR=/usr/people/argv/bin
  74. X+ 
  75. X  CFLAGS= -O
  76. X  LDFLAGS= 
  77. X  LIBES= -lsuntool -lsunwindow -lpixrect
  78. X  
  79. X! all: qix
  80. X! 
  81. X! qix:    ${OBJS}
  82. X      @echo loading...
  83. X      @cc ${LDFLAGS} ${OBJS} ${LIBES} -o qix
  84. X  
  85. X+ install: all
  86. X+     install -s -c -m 2711 -o games -g games qix ${BINDIR}
  87. X+     touch ${SCOREFILE}
  88. X+     chmod 660 ${SCOREFILE}
  89. X+     -chgrp games ${SCOREFILE}
  90. X+     -chown games ${SCOREFILE}
  91. X+ 
  92. X+ score.o:
  93. X+     cc $(CFLAGS) -DSCOREFILE=\"${SCOREFILE}\" -c score.c
  94. X+ 
  95. X  # qix with a recursive polygon file rather than iterative.
  96. X  # If you use it you have to unlimit the stacksize in csh
  97. X  # and check the code to make sure it's called right (it's old).
  98. X***************
  99. X*** 25,27 ****
  100. X--- 43,86 ----
  101. X      btoa > qix.tarmail
  102. X  
  103. X  shar: ; shar Makefile qix.h ${CFILES} ${ICONS} > qix.shar
  104. X+ 
  105. X+ clean:
  106. X+     rm -f qix $(OBJS)
  107. X+ 
  108. X+ lint:
  109. X+     lint -hbx $(CPPFLAGS) $(CFILES) $(LIBES)
  110. X+ 
  111. X+ depend: $(CFILES)
  112. X+     makedep -i $(CPPFLAGS) $(CFILES)
  113. X+ 
  114. X+ # DO NOT EDIT BELOW THIS LINE -- or it will disappear when you "make depend"
  115. X+ 
  116. X+ main.o: ./qix.icon
  117. X+ main.o: main.c
  118. X+ 
  119. X+ joystick.o: ./joystick.dn
  120. X+ joystick.o: ./joystick.lf
  121. X+ joystick.o: ./joystick.rt
  122. X+ joystick.o: ./joystick.stop
  123. X+ joystick.o: ./joystick.up
  124. X+ joystick.o: ./marker.cursor
  125. X+ joystick.o: ./mouse.rt.icon
  126. X+ joystick.o: joystick.c
  127. X+ 
  128. X+ sparks.o: ./spark1.pr
  129. X+ sparks.o: ./spark2.pr
  130. X+ sparks.o: ./spark3.pr
  131. X+ sparks.o: ./spark4.pr
  132. X+ sparks.o: sparks.c
  133. X+ 
  134. X+ regions.o: regions.c
  135. X+ 
  136. X+ qmove.o: qmove.c
  137. X+ 
  138. X+ polyfill.o: polyfill.c
  139. X+ 
  140. X+ polygon_area.o: polygon_area.c
  141. X+ 
  142. X+ polyfill_rec.o: polyfill_rec.c
  143. X+ 
  144. X+ score.o: score.c
  145. X*** OLD/joystick.c    Tue Jan 12 17:30:52 1988
  146. X--- joystick.c    Mon Mar  7 21:40:32 1988
  147. X***************
  148. X*** 108,114 ****
  149. X      if (isdigit(ID)) {
  150. X          debug = ID - '0';
  151. X          msg("Debugging level set to %d", debug);
  152. X!         sleep(2);
  153. X          remove_msgs();
  154. X          return;
  155. X      } else
  156. X--- 108,114 ----
  157. X      if (isdigit(ID)) {
  158. X          debug = ID - '0';
  159. X          msg("Debugging level set to %d", debug);
  160. X!         Sleep(2);
  161. X          remove_msgs();
  162. X          return;
  163. X      } else
  164. X***************
  165. X*** 164,172 ****
  166. X          moving = DOWN;
  167. X      when 'k' : case 'K' : case KEY_RIGHT(8) :
  168. X          moving = UP;
  169. X!     when LOC_MOVE : break; /* let those thru! */
  170. X  #ifdef DEBUG
  171. X!     case '@' : no_qix_kill = !no_qix_kill; drawing = 0;
  172. X      when '#' : clear_sparks();
  173. X      when '+' : lives = min(lives+1, MAX_LIVES); update_score(); drawing = 0;
  174. X      when '-' : lives = max(lives-1, 1); update_score(); drawing = 0;
  175. X--- 164,178 ----
  176. X          moving = DOWN;
  177. X      when 'k' : case 'K' : case KEY_RIGHT(8) :
  178. X          moving = UP;
  179. X!     when LOC_MOVE : ; /* let those thru! (break-- do nothing) */
  180. X!     when 3 : /* CTRL(C) */
  181. X!         drawing = 0;        
  182. X!         if (play_mode == REAL_PLAY) {
  183. X!         lives = 0;
  184. X!         change_life(DIE);
  185. X!         }
  186. X  #ifdef DEBUG
  187. X!     when '@' : no_qix_kill = !no_qix_kill; drawing = 0;
  188. X      when '#' : clear_sparks();
  189. X      when '+' : lives = min(lives+1, MAX_LIVES); update_score(); drawing = 0;
  190. X      when '-' : lives = max(lives-1, 1); update_score(); drawing = 0;
  191. X***************
  192. X*** 198,208 ****
  193. X  
  194. X      if (!is_alive && lives > 0) {
  195. X      /* user has died and is waiting to start again */
  196. X!     sleep(2);
  197. X      change_life(LIVE);
  198. X      stop_timer(); /* change_life restarts it */
  199. X      msg("Ready?");
  200. X!     sleep(2);
  201. X      remove_msgs(0);
  202. X      start_timer();
  203. X      return;
  204. X--- 204,214 ----
  205. X  
  206. X      if (!is_alive && lives > 0) {
  207. X      /* user has died and is waiting to start again */
  208. X!     Sleep(2);
  209. X      change_life(LIVE);
  210. X      stop_timer(); /* change_life restarts it */
  211. X      msg("Ready?");
  212. X!     Sleep(2);
  213. X      remove_msgs(0);
  214. X      start_timer();
  215. X      return;
  216. X***************
  217. X*** 281,287 ****
  218. X              when SHOW_QIX :
  219. X              remove_msgs(0);
  220. X              msg("Your Enemies:");
  221. X!             sleep(2);
  222. X              time_left = 40;
  223. X              when SHOW_SPARKS :
  224. X              time_left = 90;
  225. X--- 287,293 ----
  226. X              when SHOW_QIX :
  227. X              remove_msgs(0);
  228. X              msg("Your Enemies:");
  229. X!             Sleep(2);
  230. X              time_left = 40;
  231. X              when SHOW_SPARKS :
  232. X              time_left = 90;
  233. X***************
  234. X*** 298,304 ****
  235. X              change_life(LIVE);
  236. X              stop_timer();
  237. X          msg("Enclose more than\n75%%\nof the play area for extra bonus.");
  238. X!             sleep(2);
  239. X              remove_msgs(0);
  240. X              level = -2;
  241. X              drawing = fast = 1;
  242. X--- 304,310 ----
  243. X              change_life(LIVE);
  244. X              stop_timer();
  245. X          msg("Enclose more than\n75%%\nof the play area for extra bonus.");
  246. X!             Sleep(2);
  247. X              remove_msgs(0);
  248. X              level = -2;
  249. X              drawing = fast = 1;
  250. X***************
  251. X*** 308,322 ****
  252. X          when SHOW_QIX :
  253. X              move_qix();
  254. X              if (time_left == 1) {
  255. X!             pw_text(draw_win, 200,200,PIX_SRC,big_font, "The qix.");
  256. X!             sleep(2);
  257. X              }
  258. X          when SHOW_SPARKS :
  259. X              move_sparks();
  260. X              if (time_left == 1) {
  261. X!             pw_text(draw_win, 15, 110, PIX_SRC, big_font, "Sparx.");
  262. X!             pw_text(draw_win,625, 110, PIX_SRC, big_font, "Sparx.");
  263. X!             sleep(2);
  264. X              }
  265. X          when SHOW_FUSE :
  266. X              /* after the pw_text, this moves into spiral death trap */
  267. X--- 314,335 ----
  268. X          when SHOW_QIX :
  269. X              move_qix();
  270. X              if (time_left == 1) {
  271. X!             pw_putattributes(draw_win, &text_mask);
  272. X!             pw_text(draw_win, 200,200,PIX_SRC|PIX_COLOR(TEXT_COLOR),
  273. X!                 big_font, "The qix.");
  274. X!             Sleep(2);
  275. X              }
  276. X          when SHOW_SPARKS :
  277. X              move_sparks();
  278. X              if (time_left == 1) {
  279. X!             pw_putattributes(draw_win, &text_mask);
  280. X!             pw_text(draw_win, 15, 110, 
  281. X!                 PIX_SRC|PIX_COLOR(TEXT_COLOR), 
  282. X!                 big_font, "Sparx.");
  283. X!             pw_text(draw_win,625, 110, 
  284. X!                 PIX_SRC|PIX_COLOR(TEXT_COLOR), 
  285. X!                 big_font, "Sparx.");
  286. X!             Sleep(2);
  287. X              }
  288. X          when SHOW_FUSE :
  289. X              /* after the pw_text, this moves into spiral death trap */
  290. X***************
  291. X*** 323,334 ****
  292. X              switch (time_left) {
  293. X              when 230 :
  294. X                  drawing = 0;
  295. X                  pw_text(draw_win,
  296. X                  convert_x(pen_x - 7), convert_y(pen_y + 7),
  297. X!                 PIX_SRC, big_font, "The fuse.");
  298. X              when 80 :
  299. X                  pw_text(draw_win, 265, 445,
  300. X!                 PIX_SRC, big_font, "The Spiral Death Trap.");
  301. X              case 200 : case 240 : case 40 : case 20 :
  302. X                  moving = LEFT, drawing = 1;
  303. X              when 110 : case  55 : case 30 : moving = RIGHT;
  304. X--- 336,351 ----
  305. X              switch (time_left) {
  306. X              when 230 :
  307. X                  drawing = 0;
  308. X+                 pw_putattributes(draw_win, &text_mask);
  309. X                  pw_text(draw_win,
  310. X                  convert_x(pen_x - 7), convert_y(pen_y + 7),
  311. X!                 PIX_SRC|PIX_COLOR(TEXT_COLOR), 
  312. X!                 big_font, "The fuse.");
  313. X              when 80 :
  314. X+                 pw_putattributes(draw_win, &text_mask);
  315. X                  pw_text(draw_win, 265, 445,
  316. X!                 PIX_SRC|PIX_COLOR(TEXT_COLOR), 
  317. X!                 big_font, "The Spiral Death Trap.");
  318. X              case 200 : case 240 : case 40 : case 20 :
  319. X                  moving = LEFT, drawing = 1;
  320. X              when 110 : case  55 : case 30 : moving = RIGHT;
  321. X***************
  322. X*** 342,348 ****
  323. X              goto movit;
  324. X              } else if (region) {
  325. X              move_fuse(fuse = NULL);
  326. X!             rm_cur_line(PIX_SRC);
  327. X              }
  328. X          when SHOW_POINTS : {
  329. X              char buf[5];
  330. X--- 359,365 ----
  331. X              goto movit;
  332. X              } else if (region) {
  333. X              move_fuse(fuse = NULL);
  334. X!             rm_cur_line(PIX_SRC|PIX_COLOR(BORDER_COLOR));
  335. X              }
  336. X          when SHOW_POINTS : {
  337. X              char buf[5];
  338. X***************
  339. X*** 358,371 ****
  340. X              when 250 : case 130 : moving = RIGHT;
  341. X              when 230 : case  90 : moving = DOWN;
  342. X              when 210 : drawing = 0, moving = RIGHT;
  343. X                  pw_text(draw_win,
  344. X                  convert_x(pen_x - 12), convert_y(pen_y - 25),
  345. X!                 PIX_SRC, big_font, sprintf(buf, "%d", score));
  346. X              when 49 : /* make sure region is closed */
  347. X                  msg("Use RIGHT mouse button to STOP movement.");
  348. X                  pw_text(draw_win,
  349. X                  convert_x(pen_x - 12), convert_y(pen_y - 25),
  350. X!                 PIX_SRC, big_font, sprintf(buf, "%d", score));
  351. X              when 15 : drawing = 0, moving = RIGHT;
  352. X              }
  353. X              goto movit; /* avoid moving qix and sparks */
  354. X--- 375,392 ----
  355. X              when 250 : case 130 : moving = RIGHT;
  356. X              when 230 : case  90 : moving = DOWN;
  357. X              when 210 : drawing = 0, moving = RIGHT;
  358. X+                 pw_putattributes(draw_win, &text_mask);
  359. X                  pw_text(draw_win,
  360. X                  convert_x(pen_x - 12), convert_y(pen_y - 25),
  361. X!                 PIX_SRC|PIX_COLOR(TEXT_COLOR), 
  362. X!                 big_font, sprintf(buf, "%d", score));
  363. X              when 49 : /* make sure region is closed */
  364. X                  msg("Use RIGHT mouse button to STOP movement.");
  365. X+                 pw_putattributes(draw_win, &text_mask);
  366. X                  pw_text(draw_win,
  367. X                  convert_x(pen_x - 12), convert_y(pen_y - 25),
  368. X!                 PIX_SRC|PIX_COLOR(TEXT_COLOR), 
  369. X!                 big_font, sprintf(buf, "%d", score));
  370. X              when 15 : drawing = 0, moving = RIGHT;
  371. X              }
  372. X              goto movit; /* avoid moving qix and sparks */
  373. X***************
  374. X*** 493,500 ****
  375. X          board[pen_x][pen_y] |= CL_LN_DN;
  376. X          board[x][y] |= CL_LN_UP;
  377. X      }
  378. X      draw(convert_x(x), convert_y(y),
  379. X!          convert_x(pen_x), convert_y(pen_y), PIX_SRC);
  380. X      if (!region) {
  381. X          saved_edge = old_value;
  382. X          add_to_line(pen_x, pen_y);
  383. X--- 514,523 ----
  384. X          board[pen_x][pen_y] |= CL_LN_DN;
  385. X          board[x][y] |= CL_LN_UP;
  386. X      }
  387. X+     pw_putattributes(draw_win, &border_mask);
  388. X      draw(convert_x(x), convert_y(y),
  389. X!          convert_x(pen_x), convert_y(pen_y), 
  390. X!          PIX_SRC|PIX_COLOR(BORDER_COLOR));
  391. X      if (!region) {
  392. X          saved_edge = old_value;
  393. X          add_to_line(pen_x, pen_y);
  394. X***************
  395. X*** 518,524 ****
  396. X              }
  397. X          } else
  398. X              level++;
  399. X!         sleep(3);
  400. X          clear_board(); /* removes msgs also */
  401. X          change_life(LIVE);
  402. X          stop_timer();
  403. X--- 541,547 ----
  404. X              }
  405. X          } else
  406. X              level++;
  407. X!         Sleep(3);
  408. X          clear_board(); /* removes msgs also */
  409. X          change_life(LIVE);
  410. X          stop_timer();
  411. X***************
  412. X*** 526,532 ****
  413. X              level++;
  414. X          if (level == 0) {
  415. X              msg("Split the 2 qix to advance score multiplier.");
  416. X!             sleep(2);
  417. X              remove_msgs(0);
  418. X          }
  419. X          start_timer();
  420. X--- 549,555 ----
  421. X              level++;
  422. X          if (level == 0) {
  423. X              msg("Split the 2 qix to advance score multiplier.");
  424. X!             Sleep(2);
  425. X              remove_msgs(0);
  426. X          }
  427. X          start_timer();
  428. X***************
  429. X*** 551,561 ****
  430. X               moving == UP? &joystick_up :
  431. X               moving == DOWN? &joystick_down :
  432. X               moving == STOP? &joystick_stop : &ready_icon;
  433. X      pw_rop(joystick_win,
  434. X!     BOARD_WIDTH_IN_PIXELS/2-32, 2, 64, 64, PIX_SRC, image, 0,0);
  435. X!     pw_rop(joystick_win, 100,32, 16,23, PIX_SRC,
  436. X      (drawing && fast)? &ms_fast_on : &ms_fast_off, 0, 0);
  437. X!     pw_rop(joystick_win, 150,32, 16,23, PIX_SRC,
  438. X      (drawing && !fast)? &ms_slow_on : &ms_slow_off, 0, 0);
  439. X  }
  440. X  
  441. X--- 574,586 ----
  442. X               moving == UP? &joystick_up :
  443. X               moving == DOWN? &joystick_down :
  444. X               moving == STOP? &joystick_stop : &ready_icon;
  445. X+     pw_putattributes(joystick_win, &border_mask);
  446. X      pw_rop(joystick_win,
  447. X!     BOARD_WIDTH_IN_PIXELS/2-32, 2, 64, 64, PIX_SRC|PIX_COLOR(BORDER_COLOR),
  448. X!     image, 0,0);
  449. X!     pw_rop(joystick_win, 100,32, 16,23, PIX_SRC|PIX_COLOR(BORDER_COLOR),
  450. X      (drawing && fast)? &ms_fast_on : &ms_fast_off, 0, 0);
  451. X!     pw_rop(joystick_win, 150,32, 16,23, PIX_SRC|PIX_COLOR(BORDER_COLOR),
  452. X      (drawing && !fast)? &ms_slow_on : &ms_slow_off, 0, 0);
  453. X  }
  454. X  
  455. X*** OLD/main.c    Tue Jan 12 17:09:06 1988
  456. X--- main.c    Mon Mar  7 21:45:09 1988
  457. X***************
  458. X*** 3,12 ****
  459. X   * Appearance ONLY shamelessly stolen from the real video game wonderfully
  460. X   * and admirably written by individual(s) unknown at Taito Corp (I think).
  461. X   *
  462. X!  * Copyright 1987 by Dan Heller (island!argv@sun.com or argv@spam.istc.sri.com)
  463. X   *
  464. X   * Various polygon filling routines written by
  465. X!  *   -- Dan "Sky" Shultz (island!sky@sun.com)  and
  466. X   *   -- Don Hatch (splat%ucscb@ucscc.ucsc.edu [fall, 1987])
  467. X   *      additional help (general debugging, recursive polyfill)
  468. X   *
  469. X--- 3,14 ----
  470. X   * Appearance ONLY shamelessly stolen from the real video game wonderfully
  471. X   * and admirably written by individual(s) unknown at Taito Corp (I think).
  472. X   *
  473. X!  * Copyright 1987 by Dan Heller
  474. X!  *    island!argv@sun.com
  475. X!  *    dheller@dheller@ucbcory.berkeley.edu
  476. X   *
  477. X   * Various polygon filling routines written by
  478. X!  *   -- Dan "Sky" Shultz
  479. X   *   -- Don Hatch (splat%ucscb@ucscc.ucsc.edu [fall, 1987])
  480. X   *      additional help (general debugging, recursive polyfill)
  481. X   *
  482. X***************
  483. X*** 33,38 ****
  484. X--- 35,46 ----
  485. X  
  486. X  int (*old_repaint_func)();
  487. X  
  488. X+ int qix_mask         = 0x7;
  489. X+ int text_mask         = TEXT_COLOR;
  490. X+ int fast_draw_mask     = FAST_DRAW_COLOR;
  491. X+ int slow_draw_mask     = SLOW_DRAW_COLOR;
  492. X+ int border_mask        = BORDER_COLOR;
  493. X+ int all_mask        = 0xff;
  494. X  
  495. X  redraw(args)
  496. X  {
  497. X***************
  498. X*** 51,57 ****
  499. X      (void) signal(SIGSEGV, catch);
  500. X      (void) signal(SIGXCPU, catch);
  501. X  
  502. X- #ifdef DEBUG
  503. X      /*
  504. X       * specify debug levels "-d level"
  505. X       * a level of 2 prints polygon fill info. 4 disables spark-generation
  506. X--- 59,64 ----
  507. X***************
  508. X*** 58,64 ****
  509. X       * but doesn't kill current sparks.  debug level 1 does prints things...
  510. X       */
  511. X      while (*++newargv)
  512. X!     if (!strcmp(*newargv, "-q"))
  513. X          no_qix_kill = 1;
  514. X      else if (!strcmp(*newargv, "-d"))
  515. X          debug = (*++newargv) ? atoi(*newargv) : 1;
  516. X--- 65,79 ----
  517. X       * but doesn't kill current sparks.  debug level 1 does prints things...
  518. X       */
  519. X      while (*++newargv)
  520. X!     if (!strcmp(*newargv, "-s"))
  521. X!         if (!*++newargv)
  522. X!         puts("usage: qix [-s timeout] (in milliseconds)"), exit(1);
  523. X!         else {
  524. X!         if ((interval = atoi(*newargv)) < 15000 || interval > 60000)
  525. X!             puts("delay must be between 15000 and 60000"), exit(1);
  526. X!         }
  527. X! #ifdef DEBUG
  528. X!     else if (!strcmp(*newargv, "-q"))
  529. X          no_qix_kill = 1;
  530. X      else if (!strcmp(*newargv, "-d"))
  531. X          debug = (*++newargv) ? atoi(*newargv) : 1;
  532. X***************
  533. X*** 79,84 ****
  534. X--- 94,101 ----
  535. X      0);
  536. X  
  537. X      draw_win = canvas_pixwin(Draw);
  538. X+     if (interval == 0)
  539. X+     interval = (draw_win->pw_pixrect->pr_depth == 8)? 35000 : 50000;
  540. X      window_set(Draw,
  541. X      CANVAS_FAST_MONO, TRUE,
  542. X      WIN_CONSUME_PICK_EVENTS,
  543. X***************
  544. X*** 99,104 ****
  545. X--- 116,165 ----
  546. X      0);
  547. X      joystick_win = canvas_pixwin(Joystick);
  548. X  
  549. X+     /*
  550. X+      *     set color map segment name and load color map
  551. X+      */
  552. X+     {
  553. X+     static char cmsname[CMS_NAMESIZE];
  554. X+     static char r[QIX_CMS_SIZE],g[QIX_CMS_SIZE],b[QIX_CMS_SIZE];
  555. X+ 
  556. X+     (void) strcpy(cmsname, QIX_CMS_NAME);
  557. X+     pw_setcmsname(draw_win, cmsname);
  558. X+     pw_setcmsname(joystick_win, cmsname);
  559. X+ 
  560. X+     /* blueish */
  561. X+     r[FAST_DRAW_COLOR] = 40;
  562. X+     g[FAST_DRAW_COLOR] = 170;
  563. X+     b[FAST_DRAW_COLOR] = 213;
  564. X+ 
  565. X+     /* brownish */
  566. X+     r[SLOW_DRAW_COLOR] = 213;
  567. X+     g[SLOW_DRAW_COLOR] = 170;
  568. X+     b[SLOW_DRAW_COLOR] = 0;
  569. X+ 
  570. X+     /* dark something */
  571. X+     r[TEXT_COLOR] = 0;
  572. X+     g[TEXT_COLOR] = 80;
  573. X+     b[TEXT_COLOR] = 190;
  574. X+ 
  575. X+     /* red sparks when not aggressive */
  576. X+     r[SPARKS_COLOR] = 255;
  577. X+     g[SPARKS_COLOR] = 0;
  578. X+     b[SPARKS_COLOR] = 0;
  579. X+ 
  580. X+     /* blue sparks when aggressive */
  581. X+     r[AGGR_SPARK_COLOR] = 0;
  582. X+     g[AGGR_SPARK_COLOR] = 0;
  583. X+     b[AGGR_SPARK_COLOR] = 255;
  584. X+ 
  585. X+     cms_rainbowsetup(&r[QIX_COLOR_BASE],
  586. X+              &g[QIX_COLOR_BASE],
  587. X+              &b[QIX_COLOR_BASE]);
  588. X+ 
  589. X+     pw_putcolormap(draw_win, 0, QIX_CMS_SIZE, r, g, b);
  590. X+     pw_putcolormap(joystick_win, 0, QIX_CMS_SIZE, r, g, b);
  591. X+     }
  592. X+ 
  593. X      window_fit(frame);
  594. X  
  595. X      if (!(small_font = pf_open("/usr/people/argv/computer.14")) &&
  596. X***************
  597. X*** 120,126 ****
  598. X      pw_text(joystick_win, 92, 24, PIX_SRC, small_font, "Fast  Slow");
  599. X      play_mode = SHOW_SCORES;
  600. X      update_score();
  601. X!     score_board(TRUE, FALSE);
  602. X      time_left = 100; /* timeout before next demo mode switch */
  603. X      (void) signal(SIGALRM, move_pen);
  604. X      old_repaint_func = (int(*)())window_get(frame, CANVAS_REPAINT_PROC);
  605. X--- 181,187 ----
  606. X      pw_text(joystick_win, 92, 24, PIX_SRC, small_font, "Fast  Slow");
  607. X      play_mode = SHOW_SCORES;
  608. X      update_score();
  609. X!     (void) score_board(TRUE, FALSE);
  610. X      time_left = 100; /* timeout before next demo mode switch */
  611. X      (void) signal(SIGALRM, move_pen);
  612. X      old_repaint_func = (int(*)())window_get(frame, CANVAS_REPAINT_PROC);
  613. X***************
  614. X*** 141,152 ****
  615. X      pen_x = (BOARD_WIDTH-1)/2, pen_y = BOARD_HEIGHT-1;
  616. X      remove_msgs(1);
  617. X  
  618. X      /* give left->right sweeping effect like the real game */
  619. X      for (x = 0; x < BOARD_WIDTH_IN_PIXELS; x++)
  620. X      draw(x, 0, x, BOARD_HEIGHT_IN_PIXELS-1, PIX_CLR);
  621. X  
  622. X      box(convert_x(0), convert_y(0),
  623. X!     convert_x(BOARD_WIDTH-1), convert_y(BOARD_HEIGHT-1), PIX_SRC);
  624. X  
  625. X      /* clear the interior of the board */
  626. X      for (x = 1; x < BOARD_WIDTH-1; x++)
  627. X--- 202,217 ----
  628. X      pen_x = (BOARD_WIDTH-1)/2, pen_y = BOARD_HEIGHT-1;
  629. X      remove_msgs(1);
  630. X  
  631. X+     pw_putattributes(draw_win, &all_mask);
  632. X+ 
  633. X      /* give left->right sweeping effect like the real game */
  634. X      for (x = 0; x < BOARD_WIDTH_IN_PIXELS; x++)
  635. X      draw(x, 0, x, BOARD_HEIGHT_IN_PIXELS-1, PIX_CLR);
  636. X  
  637. X+     pw_putattributes(draw_win, &border_mask);
  638. X      box(convert_x(0), convert_y(0),
  639. X!     convert_x(BOARD_WIDTH-1), convert_y(BOARD_HEIGHT-1), 
  640. X!     PIX_SRC|PIX_COLOR(BORDER_COLOR));
  641. X  
  642. X      /* clear the interior of the board */
  643. X      for (x = 1; x < BOARD_WIDTH-1; x++)
  644. X***************
  645. X*** 194,200 ****
  646. X          lives =  1;
  647. X          else
  648. X          lives = MAX_LIVES;
  649. X!         clear_board(); /* resets pen_x, pen_y */
  650. X          level = -2, score = 0;
  651. X      } else {
  652. X          extern int qix1_x0[], qix1_x1[], qix1_y0[], qix1_y1[];
  653. X--- 259,265 ----
  654. X          lives =  1;
  655. X          else
  656. X          lives = MAX_LIVES;
  657. X!         clear_board(); /* resets pen_x, pen_y (changes plane mask) */
  658. X          level = -2, score = 0;
  659. X      } else {
  660. X          extern int qix1_x0[], qix1_x1[], qix1_y0[], qix1_y1[];
  661. X***************
  662. X*** 217,248 ****
  663. X      drawing = FALSE;
  664. X      if (level > 0) {
  665. X          msg("All scores now\n%d times\ntheir original value.", level+1);
  666. X!         sleep(3);
  667. X          remove_msgs(0);
  668. X      }
  669. X      place_pen(); /* make pen appear */
  670. X      }
  671. X  
  672. X      for (x = 0; x < 2; x++)
  673. X      for (n = m; n >= 40 && n <= 300; n -= 5 * live_or_die)
  674. X          box(pen_coord_x(pen_x)-n/2, pen_coord_y(pen_y)-n/2,
  675. X!         pen_coord_x(pen_x)+n/2, pen_coord_y(pen_y)+n/2, XOR);
  676. X  
  677. X      if (live_or_die == DIE) {
  678. X      is_alive = FALSE;
  679. X      if (--lives <= 0) {
  680. X          reset_joystick_win(TRUE);
  681. X          msg("Game Over.");
  682. X!         sleep(2);
  683. X          /* if he got on the scoreboard, let him put his initials up */
  684. X          if (play_mode == REAL_PLAY)
  685. X!         score_board(FALSE, FALSE);
  686. X          if (play_mode == SHOW_SPIRAL)
  687. X          time_left = 50; /* demo mode comes after spiral death trap */
  688. X          else {
  689. X-         score_board(TRUE, FALSE);
  690. X          play_mode = SHOW_SCORES;
  691. X!         time_left = 100; /* show scores after demo mode or real play */
  692. X          }
  693. X          moving = NO_MOVE;
  694. X      } else {
  695. X--- 282,318 ----
  696. X      drawing = FALSE;
  697. X      if (level > 0) {
  698. X          msg("All scores now\n%d times\ntheir original value.", level+1);
  699. X!         Sleep(3);
  700. X          remove_msgs(0);
  701. X      }
  702. X      place_pen(); /* make pen appear */
  703. X      }
  704. X  
  705. X+     pw_putattributes(draw_win, &border_mask);
  706. X      for (x = 0; x < 2; x++)
  707. X      for (n = m; n >= 40 && n <= 300; n -= 5 * live_or_die)
  708. X          box(pen_coord_x(pen_x)-n/2, pen_coord_y(pen_y)-n/2,
  709. X!         pen_coord_x(pen_x)+n/2, pen_coord_y(pen_y)+n/2, 
  710. X!         XOR | PIX_COLOR(BORDER_COLOR));
  711. X  
  712. X      if (live_or_die == DIE) {
  713. X      is_alive = FALSE;
  714. X      if (--lives <= 0) {
  715. X+         int do_scores = TRUE;
  716. X          reset_joystick_win(TRUE);
  717. X          msg("Game Over.");
  718. X!         Sleep(2);
  719. X          /* if he got on the scoreboard, let him put his initials up */
  720. X          if (play_mode == REAL_PLAY)
  721. X!         do_scores = (score_board(FALSE, FALSE) == 0);
  722. X          if (play_mode == SHOW_SPIRAL)
  723. X          time_left = 50; /* demo mode comes after spiral death trap */
  724. X          else {
  725. X          play_mode = SHOW_SCORES;
  726. X!         if (do_scores)
  727. X!             (void) score_board(TRUE, FALSE), time_left = 300;
  728. X!         else
  729. X!             time_left = 100;
  730. X          }
  731. X          moving = NO_MOVE;
  732. X      } else {
  733. X***************
  734. X*** 263,284 ****
  735. X      int x;
  736. X  
  737. X      sprintf(buf, "Score: %6d", score);
  738. X!     pw_text(joystick_win, 500, 22, PIX_SRC, big_font, buf);
  739. X!     pw_text(joystick_win, 500, 22, PIX_SRC|PIX_DST, big_font, buf);
  740. X  
  741. X      if (play_mode != REAL_PLAY) {
  742. X!     pw_text(draw_win, 105, 12, PIX_SRC, small_font,
  743. X          "Click RIGHT mouse button or use <spacebar> to start new game.");
  744. X      return;
  745. X      }
  746. X  
  747. X!     pw_text(joystick_win, 500, 45, PIX_SRC, big_font, "Lives: ");
  748. X      for (x = 0; x < MAX_LIVES; x++)
  749. X!     pw_rop(joystick_win, 575+(x*20), 32, 16,16, (x < lives-1)?
  750. X!         PIX_SRC:PIX_CLR, &pen_image, 0, 0);
  751. X      sprintf(buf, "Filled: %d%%",(int)((double)area_closed/TOTAL_AREA*100));
  752. X!     pw_text(draw_win, 280, 12, PIX_SRC, small_font, buf);
  753. X!     pw_text(draw_win, 281, 12, PIX_SRC|PIX_DST, small_font, buf);
  754. X  }
  755. X  
  756. X  Pixrect *save[15];  /* area under text to be redisplayed upon removal of text */
  757. X--- 333,362 ----
  758. X      int x;
  759. X  
  760. X      sprintf(buf, "Score: %6d", score);
  761. X!     pw_putattributes(joystick_win, &text_mask);
  762. X!     pw_text(joystick_win, 500, 22, PIX_SRC|PIX_COLOR(TEXT_COLOR), 
  763. X!     big_font, buf);
  764. X!     pw_text(joystick_win, 500, 22, PIX_SRC|PIX_DST|PIX_COLOR(TEXT_COLOR), 
  765. X!     big_font, buf);
  766. X  
  767. X      if (play_mode != REAL_PLAY) {
  768. X!     pw_text(draw_win, 105, 12, PIX_SRC|PIX_COLOR(TEXT_COLOR), small_font,
  769. X          "Click RIGHT mouse button or use <spacebar> to start new game.");
  770. X      return;
  771. X      }
  772. X  
  773. X!     pw_text(joystick_win, 500, 45, PIX_SRC|PIX_COLOR(TEXT_COLOR), 
  774. X!         big_font, "Lives: ");
  775. X!     pw_putattributes(joystick_win, &border_mask);
  776. X      for (x = 0; x < MAX_LIVES; x++)
  777. X!     pw_rop(joystick_win, 575+(x*20), 32, 16,16, ((x < lives-1)?
  778. X!         PIX_SRC:PIX_CLR)|PIX_COLOR(BORDER_COLOR), &pen_image, 0, 0);
  779. X! 
  780. X      sprintf(buf, "Filled: %d%%",(int)((double)area_closed/TOTAL_AREA*100));
  781. X!     pw_putattributes(draw_win, &text_mask);
  782. X!     pw_text(draw_win, 280, 12, PIX_SRC|PIX_COLOR(TEXT_COLOR), small_font, buf);
  783. X!     pw_text(draw_win, 281, 12, PIX_SRC|PIX_DST|PIX_COLOR(TEXT_COLOR), 
  784. X!     small_font, buf);
  785. X  }
  786. X  
  787. X  Pixrect *save[15];  /* area under text to be redisplayed upon removal of text */
  788. X***************
  789. X*** 286,291 ****
  790. X--- 364,370 ----
  791. X  static int msgs;   /* the number of text lines displayed on the board */
  792. X  
  793. X  /* print a message somewhere at the top of the playing board for two seconds */
  794. X+ /*VARARGS1*/
  795. X  msg(fmt, args)
  796. X  char *fmt;
  797. X  {
  798. X***************
  799. X*** 298,303 ****
  800. X--- 377,383 ----
  801. X  #ifdef DEBUG
  802. X      puts(buf);
  803. X  #endif DEBUG
  804. X+     pw_putattributes(draw_win, &text_mask);
  805. X      do  {
  806. X      if (p2 = index(p, '\n'))
  807. X          *p2 = 0;
  808. X***************
  809. X*** 313,321 ****
  810. X             draw_win->pw_prretained, x_pos[msgs], y_pos[msgs]);
  811. X  
  812. X      pw_text(draw_win, x_pos[msgs], y_pos[msgs]+l_height(big_font)-5,
  813. X!         PIX_SRC, big_font, p);
  814. X      pw_text(draw_win, x_pos[msgs]+1, y_pos[msgs]+l_height(big_font)-5,
  815. X!         PIX_SRC|PIX_DST, big_font, p);
  816. X      } while (++msgs < 15 && p2 && *(p = p2+1));
  817. X  }
  818. X  
  819. X--- 393,401 ----
  820. X             draw_win->pw_prretained, x_pos[msgs], y_pos[msgs]);
  821. X  
  822. X      pw_text(draw_win, x_pos[msgs], y_pos[msgs]+l_height(big_font)-5,
  823. X!         PIX_SRC | PIX_COLOR(TEXT_COLOR), big_font, p);
  824. X      pw_text(draw_win, x_pos[msgs]+1, y_pos[msgs]+l_height(big_font)-5,
  825. X!         PIX_SRC|PIX_DST | PIX_COLOR(TEXT_COLOR), big_font, p);
  826. X      } while (++msgs < 15 && p2 && *(p = p2+1));
  827. X  }
  828. X  
  829. X***************
  830. X*** 322,331 ****
  831. X  /* remove all messages from the board and put back the images underneith */
  832. X  remove_msgs(clearing)
  833. X  {
  834. X      while (msgs--) {
  835. X      if (!clearing)
  836. X          pw_rop(draw_win, x_pos[msgs], y_pos[msgs], x_save[msgs],  y_save,
  837. X!         PIX_SRC, save[msgs], 0, 0);
  838. X      pr_destroy(save[msgs]);
  839. X      }
  840. X      msgs = 0;
  841. X--- 402,412 ----
  842. X  /* remove all messages from the board and put back the images underneith */
  843. X  remove_msgs(clearing)
  844. X  {
  845. X+     pw_putattributes(draw_win, &text_mask);
  846. X      while (msgs--) {
  847. X      if (!clearing)
  848. X          pw_rop(draw_win, x_pos[msgs], y_pos[msgs], x_save[msgs],  y_save,
  849. X!         PIX_SRC | PIX_COLOR(TEXT_COLOR), save[msgs], 0, 0);
  850. X      pr_destroy(save[msgs]);
  851. X      }
  852. X      msgs = 0;
  853. X***************
  854. X*** 336,342 ****
  855. X      stop_timer();
  856. X      if (sig == SIGXCPU) {
  857. X      msg("CPU timelimit exceeded.  Go home and eat dinner.");
  858. X!     sleep(2);
  859. X      remove_msgs(0);
  860. X      return;
  861. X      }
  862. X--- 417,423 ----
  863. X      stop_timer();
  864. X      if (sig == SIGXCPU) {
  865. X      msg("CPU timelimit exceeded.  Go home and eat dinner.");
  866. X!     Sleep(2);
  867. X      remove_msgs(0);
  868. X      return;
  869. X      }
  870. X***************
  871. X*** 346,349 ****
  872. X--- 427,448 ----
  873. X      else
  874. X      fprintf(stderr, "Bus Error\n");
  875. X      abort();
  876. X+ }
  877. X+ 
  878. X+ void
  879. X+ flush_events()
  880. X+ {
  881. X+     struct timeval dummy;
  882. X+     Event event;
  883. X+     int readfd = 1 << (int)window_get(Draw, WIN_FD);
  884. X+ 
  885. X+     timerclear(&dummy);
  886. X+     while (select(readfd+1, &readfd, 0, 0, &dummy) > 0)
  887. X+     window_read_event(Draw, &event);
  888. X+ }
  889. X+ 
  890. X+ Sleep(n)
  891. X+ {
  892. X+     sleep(n);
  893. X+     flush_events();
  894. X  }
  895. X*** OLD/qix.h    Wed Dec 23 17:50:58 1987
  896. X--- qix.h    Mon Mar  7 21:28:36 1988
  897. X***************
  898. X*** 19,28 ****
  899. X  #include <sys/time.h>
  900. X  #include <ctype.h>
  901. X  
  902. X  #define when         break;case
  903. X  #define otherwise    break;default
  904. X  #define rrand        random
  905. X- #define SCOREFILE    "qix.scores"
  906. X  
  907. X  Frame        frame;
  908. X  Canvas        Draw, Joystick;
  909. X--- 19,48 ----
  910. X  #include <sys/time.h>
  911. X  #include <ctype.h>
  912. X  
  913. X+ #include <sunwindow/cms_rainbow.h>
  914. X+ 
  915. X+ /* qix uses 0..7 */
  916. X+ #define QIX_COLOR_BASE  0
  917. X+ #define TEXT_COLOR    8
  918. X+ #define SLOW_DRAW_COLOR 16
  919. X+ #define FAST_DRAW_COLOR 32
  920. X+ #define SPARKS_COLOR     RED
  921. X+ #define AGGR_SPARK_COLOR     BLUE
  922. X+ #define BORDER_COLOR     128
  923. X+ 
  924. X+ #define QIX_CMS_SIZE    256
  925. X+ #define QIX_CMS_NAME    "QIX"
  926. X+ 
  927. X+ extern int text_mask;
  928. X+ extern int qix_mask;
  929. X+ extern int fast_draw_mask;
  930. X+ extern int slow_draw_mask;
  931. X+ extern int border_mask;
  932. X+ extern int all_mask;
  933. X+ 
  934. X  #define when         break;case
  935. X  #define otherwise    break;default
  936. X  #define rrand        random
  937. X  
  938. X  Frame        frame;
  939. X  Canvas        Draw, Joystick;
  940. X***************
  941. X*** 44,51 ****
  942. X  
  943. X  struct itimerval timeout;
  944. X  
  945. X  #define start_timer()  \
  946. X!     timeout.it_value.tv_usec = 50000, setitimer(ITIMER_REAL, &timeout, NULL);
  947. X  #define stop_timer()  \
  948. X      timerclear(&timeout.it_value), setitimer(ITIMER_REAL, &timeout, NULL);
  949. X  
  950. X--- 64,72 ----
  951. X  
  952. X  struct itimerval timeout;
  953. X  
  954. X+ long interval; /* 50000 for monochrome or 35000 for color displays */
  955. X  #define start_timer()  \
  956. X!     timeout.it_value.tv_usec = interval, setitimer(ITIMER_REAL, &timeout, NULL);
  957. X  #define stop_timer()  \
  958. X      timerclear(&timeout.it_value), setitimer(ITIMER_REAL, &timeout, NULL);
  959. X  
  960. X***************
  961. X*** 105,113 ****
  962. X  extern Pixrect pen_image;
  963. X  
  964. X  /* place_pen() macro XOR's the pen at its current coordinates */
  965. X! #define place_pen()   pw_rop(draw_win, \
  966. X!         pen_coord_x(pen_x), pen_coord_y(pen_y), \
  967. X!         16, 16, XOR, &pen_image, 0, 0)
  968. X  
  969. X  #define XOR (PIX_SRC^PIX_DST)
  970. X  #define draw(x1,y1,x2,y2,OP)     pw_vector(draw_win, x1,y1,x2,y2,(OP),1)
  971. X--- 126,136 ----
  972. X  extern Pixrect pen_image;
  973. X  
  974. X  /* place_pen() macro XOR's the pen at its current coordinates */
  975. X! #define place_pen() \
  976. X!         pw_putattributes(draw_win, &qix_mask), \
  977. X!         pw_rop(draw_win, \
  978. X!         pen_coord_x(pen_x), pen_coord_y(pen_y), \
  979. X!         16, 16, XOR|PIX_COLOR(VIOLET), &pen_image, 0, 0)
  980. X  
  981. X  #define XOR (PIX_SRC^PIX_DST)
  982. X  #define draw(x1,y1,x2,y2,OP)     pw_vector(draw_win, x1,y1,x2,y2,(OP),1)
  983. X*** OLD/qmove.c    Mon Jan 11 14:53:04 1988
  984. X--- qmove.c    Mon Mar  7 21:41:38 1988
  985. X***************
  986. X*** 38,44 ****
  987. X      static index = 0, count;
  988. X      int i, j;
  989. X  
  990. X!     if (level < 0 && count++ & 1)
  991. X      return 0;
  992. X  
  993. X      if (qix1_x0[index] <= 0)
  994. X--- 38,44 ----
  995. X      static index = 0, count;
  996. X      int i, j;
  997. X  
  998. X!     if (level < -1 && count++ & 1)
  999. X      return 0;
  1000. X  
  1001. X      if (qix1_x0[index] <= 0)
  1002. X***************
  1003. X*** 87,97 ****
  1004. X      i = (index + 1) % NLINES;
  1005. X  
  1006. X      /* erase old line */
  1007. X      draw(convert_x(qix1_x0[i]), convert_y(qix1_y0[i]),
  1008. X!      convert_x(qix1_x1[i]), convert_y(qix1_y1[i]), PIX_CLR);
  1009. X      if (level > -1)
  1010. X      draw(convert_x(qix2_x0[i]), convert_y(qix2_y0[i]),
  1011. X!          convert_x(qix2_x1[i]), convert_y(qix2_y1[i]), PIX_CLR);
  1012. X  
  1013. X      qix1_x0[i] = qix1_x0[index] + qix1_dx0;
  1014. X      qix1_y0[i] = qix1_y0[index] + qix1_dy0;
  1015. X--- 87,102 ----
  1016. X      i = (index + 1) % NLINES;
  1017. X  
  1018. X      /* erase old line */
  1019. X+     pw_putattributes(draw_win, &qix_mask);
  1020. X      draw(convert_x(qix1_x0[i]), convert_y(qix1_y0[i]),
  1021. X!      convert_x(qix1_x1[i]), convert_y(qix1_y1[i]), 
  1022. X!         PIX_CLR|PIX_COLOR((index % CMS_RAINBOWSIZE) + 
  1023. X!         QIX_COLOR_BASE));
  1024. X      if (level > -1)
  1025. X      draw(convert_x(qix2_x0[i]), convert_y(qix2_y0[i]),
  1026. X!          convert_x(qix2_x1[i]), convert_y(qix2_y1[i]), 
  1027. X!         PIX_CLR|PIX_COLOR((index % CMS_RAINBOWSIZE) + 
  1028. X!         QIX_COLOR_BASE));
  1029. X  
  1030. X      qix1_x0[i] = qix1_x0[index] + qix1_dx0;
  1031. X      qix1_y0[i] = qix1_y0[index] + qix1_dy0;
  1032. X***************
  1033. X*** 107,116 ****
  1034. X      index = i;
  1035. X  
  1036. X      draw(convert_x(qix1_x0[i]), convert_y(qix1_y0[i]),
  1037. X!      convert_x(qix1_x1[i]), convert_y(qix1_y1[i]), PIX_SRC);
  1038. X      if (level > -1)
  1039. X      draw(convert_x(qix2_x0[i]), convert_y(qix2_y0[i]),
  1040. X!          convert_x(qix2_x1[i]), convert_y(qix2_y1[i]), PIX_SRC);
  1041. X      return j;
  1042. X  }
  1043. X  
  1044. X--- 112,125 ----
  1045. X      index = i;
  1046. X  
  1047. X      draw(convert_x(qix1_x0[i]), convert_y(qix1_y0[i]),
  1048. X!      convert_x(qix1_x1[i]), convert_y(qix1_y1[i]), 
  1049. X!      PIX_SRC|PIX_COLOR((index % CMS_RAINBOWSIZE) + 
  1050. X!      QIX_COLOR_BASE));
  1051. X      if (level > -1)
  1052. X      draw(convert_x(qix2_x0[i]), convert_y(qix2_y0[i]),
  1053. X!          convert_x(qix2_x1[i]), convert_y(qix2_y1[i]), 
  1054. X!          PIX_SRC|PIX_COLOR((index % CMS_RAINBOWSIZE) + 
  1055. X!          QIX_COLOR_BASE));
  1056. X      return j;
  1057. X  }
  1058. X  
  1059. X***************
  1060. X*** 125,134 ****
  1061. X      if (!(rrand() % 10)) {
  1062. X      register int r;
  1063. X      /* move at least one space, but not greater than "Speed" */
  1064. X!     *dx0 = (1 + (r = rrand())%(Speed-1)) * ((r&1) ? -1 : 1);
  1065. X!     *dy0 = (1 + (r = rrand())%(Speed-1)) * ((r&1) ? -1 : 1);
  1066. X!     *dx1 = (1 + (r = rrand())%(Speed-1)) * ((r&1) ? -1 : 1);
  1067. X!     *dy1 = (1 + (r = rrand())%(Speed-1)) * ((r&1) ? -1 : 1);
  1068. X      /* check that qix is moving towards player */
  1069. X      if (level > -2 && !(rrand() % (6 - level))) {
  1070. X          if (pen_x - x0 > 0 && *dx0 < 0)
  1071. X--- 134,147 ----
  1072. X      if (!(rrand() % 10)) {
  1073. X      register int r;
  1074. X      /* move at least one space, but not greater than "Speed" */
  1075. X!     r = rrand();
  1076. X!     *dx0 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
  1077. X!     r = rrand();
  1078. X!     *dy0 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
  1079. X!     r = rrand();
  1080. X!     *dx1 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
  1081. X!     r = rrand();
  1082. X!     *dy1 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
  1083. X      /* check that qix is moving towards player */
  1084. X      if (level > -2 && !(rrand() % (6 - level))) {
  1085. X          if (pen_x - x0 > 0 && *dx0 < 0)
  1086. X***************
  1087. X*** 180,186 ****
  1088. X      if (!(++loop_count % 100)) {
  1089. X  #ifdef DEBUG
  1090. X          msg("bad news... loop count hit %d", loop_count);
  1091. X!         sleep(2);
  1092. X          remove_msgs(0);
  1093. X  #endif DEBUG
  1094. X          break;
  1095. X--- 193,199 ----
  1096. X      if (!(++loop_count % 100)) {
  1097. X  #ifdef DEBUG
  1098. X          msg("bad news... loop count hit %d", loop_count);
  1099. X!         Sleep(2);
  1100. X          remove_msgs(0);
  1101. X  #endif DEBUG
  1102. X          break;
  1103. X***************
  1104. X*** 235,241 ****
  1105. X          return 0;
  1106. X      }
  1107. X      msg("The qix is trapped in a place it shouldn't have gotten to!");
  1108. X!     sleep(2);
  1109. X      remove_msgs(0);
  1110. X      return -1;
  1111. X  }
  1112. X--- 248,254 ----
  1113. X          return 0;
  1114. X      }
  1115. X      msg("The qix is trapped in a place it shouldn't have gotten to!");
  1116. X!     Sleep(2);
  1117. X      remove_msgs(0);
  1118. X      return -1;
  1119. X  }
  1120. X*** OLD/regions.c    Mon Dec 21 22:15:46 1987
  1121. X--- regions.c    Mon Mar  7 21:41:47 1988
  1122. X***************
  1123. X*** 62,69 ****
  1124. X      return -1;
  1125. X      if (level > -1 && edge != n) {
  1126. X      msg("You split the two qix!");
  1127. X!     sleep(2);
  1128. X!     rm_cur_line(PIX_SRC); /* don't erase it, but free it up */
  1129. X      moving = STOP;
  1130. X      return 1;
  1131. X      }
  1132. X--- 62,70 ----
  1133. X      return -1;
  1134. X      if (level > -1 && edge != n) {
  1135. X      msg("You split the two qix!");
  1136. X!     Sleep(2);
  1137. X!     /* don't erase it, but free it up */
  1138. X!     rm_cur_line(PIX_SRC|PIX_COLOR(BORDER_COLOR)); 
  1139. X      moving = STOP;
  1140. X      return 1;
  1141. X      }
  1142. X***************
  1143. X*** 108,114 ****
  1144. X          msg("can't fill region; over 10000 positions");
  1145. X          pen_x = region->x, pen_y = region->y;
  1146. X          msg("removing bad line ...(takes a while)");
  1147. X!         rm_cur_line(XOR); /* causes dotted line effect */
  1148. X          remove_msgs(0);
  1149. X          return -1;
  1150. X      }
  1151. X--- 109,116 ----
  1152. X          msg("can't fill region; over 10000 positions");
  1153. X          pen_x = region->x, pen_y = region->y;
  1154. X          msg("removing bad line ...(takes a while)");
  1155. X!         /* causes dotted line effect */
  1156. X!         rm_cur_line(XOR|PIX_COLOR(BORDER_COLOR)); 
  1157. X          remove_msgs(0);
  1158. X          return -1;
  1159. X      }
  1160. X***************
  1161. X*** 258,265 ****
  1162. X  #endif
  1163. X  
  1164. X      toggle_sparks();
  1165. X!     pw_polygon_2(draw_win, 0,0,1, npts, new_area, PIX_SRC | PIX_DST,
  1166. X!     fast? &fast_grey : &slow_grey,0,0);
  1167. X      toggle_sparks();
  1168. X  
  1169. X      free(new_area);
  1170. X--- 260,270 ----
  1171. X  #endif
  1172. X  
  1173. X      toggle_sparks();
  1174. X!     pw_putattributes(draw_win, fast ? &fast_draw_mask: &slow_draw_mask);
  1175. X!     pw_polygon_2(draw_win, 0,0,1, npts, new_area, 
  1176. X!     PIX_SRC | PIX_DST | PIX_COLOR(fast ? FAST_DRAW_COLOR: SLOW_DRAW_COLOR),
  1177. X!     draw_win->pw_pixrect->pr_depth == 8? NULL :
  1178. X!     fast? &fast_grey : &slow_grey, 0, 0);
  1179. X      toggle_sparks();
  1180. X  
  1181. X      free(new_area);
  1182. X***************
  1183. X*** 278,284 ****
  1184. X      (moving == RIGHT)? "right" : "left",
  1185. X      (edge == UP)? "up" : (edge == DOWN)? "down" :
  1186. X      (edge == RIGHT)? "right" : "left");
  1187. X!     sleep(2);
  1188. X      remove_msgs(0);
  1189. X  }
  1190. X  #endif DEBUG
  1191. X--- 283,289 ----
  1192. X      (moving == RIGHT)? "right" : "left",
  1193. X      (edge == UP)? "up" : (edge == DOWN)? "down" :
  1194. X      (edge == RIGHT)? "right" : "left");
  1195. X!     Sleep(2);
  1196. X      remove_msgs(0);
  1197. X  }
  1198. X  #endif DEBUG
  1199. X***************
  1200. X*** 285,290 ****
  1201. X--- 290,296 ----
  1202. X  
  1203. X  rm_cur_line(op)
  1204. X  {
  1205. X+     pw_putattributes(draw_win, &border_mask);
  1206. X      if (region)
  1207. X      board[region->x][region->y] = saved_edge;
  1208. X      while (cur_coord)
  1209. X*** OLD/score.c    Wed Dec 23 17:47:03 1987
  1210. X--- score.c    Mon Mar  7 21:42:04 1988
  1211. X***************
  1212. X*** 15,20 ****
  1213. X--- 15,21 ----
  1214. X  extern char *sys_errlist[];
  1215. X  extern char *sprintf();
  1216. X  
  1217. X+ /* returns whether the score file can be accessed */
  1218. X  score_board(Read, names)
  1219. X  {
  1220. X      struct scores *scp, *temp;
  1221. X***************
  1222. X*** 34,46 ****
  1223. X  #endif DEBUG
  1224. X      }
  1225. X  
  1226. X!     /* read the top ten file into the array and close the file */
  1227. X!     if ((fd = open(SCOREFILE, O_RDWR)) == -1 ||
  1228. X      read(fd, (char *) top_ten, sizeof(top_ten)) == -1) {
  1229. X      msg("No score file:\n%s", sys_errlist[errno]);
  1230. X!     sleep(2);
  1231. X      remove_msgs(0);
  1232. X!     return;
  1233. X      }
  1234. X  
  1235. X      /* Print the list */
  1236. X--- 35,50 ----
  1237. X  #endif DEBUG
  1238. X      }
  1239. X  
  1240. X!     /* read the top ten file into the array and close the file. If it doesn't
  1241. X!      * open for read/write, it probably doesn't exit -- create it rw for all.
  1242. X!      */
  1243. X!     if ((fd = open(SCOREFILE, O_RDWR)) == -1 &&
  1244. X!     (Read || (fd = open(SCOREFILE, O_WRONLY, 0666))) ||
  1245. X      read(fd, (char *) top_ten, sizeof(top_ten)) == -1) {
  1246. X      msg("No score file:\n%s", sys_errlist[errno]);
  1247. X!     Sleep(2);
  1248. X      remove_msgs(0);
  1249. X!     return -1;
  1250. X      }
  1251. X  
  1252. X      /* Print the list */
  1253. X***************
  1254. X*** 75,80 ****
  1255. X--- 79,85 ----
  1256. X      }
  1257. X      }
  1258. X      (void) close(fd);
  1259. X+     return 0;
  1260. X  }
  1261. X  
  1262. X  char *
  1263. X***************
  1264. X*** 102,114 ****
  1265. X      msg("MIDDLE button to decrement one character.\n");
  1266. X      msg("Use RETURN or RIGHT button to enter each letter.");
  1267. X      msg("Use <backspace> key to go back one position.");
  1268. X!     pw_text(draw_win, x, y, PIX_SRC, big_font, sprintf(s, "%d", score));
  1269. X      x += 25 * l_width(big_font);
  1270. X      (void) strcpy(buf, "AAA");
  1271. X  
  1272. X      for (len = 0; len < 3;) {
  1273. X!     pw_text(draw_win, x - len*l_width(big_font), y, PIX_SRC, big_font, buf);
  1274. X!     pw_char(draw_win, x, y, PIX_SRC|PIX_DST, big_font, '_');
  1275. X  
  1276. X      do window_read_event(Draw, &event);
  1277. X      while (event.ie_code == LOC_MOVE || event.ie_code == LOC_DRAG ||
  1278. X--- 107,122 ----
  1279. X      msg("MIDDLE button to decrement one character.\n");
  1280. X      msg("Use RETURN or RIGHT button to enter each letter.");
  1281. X      msg("Use <backspace> key to go back one position.");
  1282. X!     pw_text(draw_win, x, y, PIX_SRC|PIX_COLOR(TEXT_COLOR), big_font,
  1283. X!         sprintf(s, "%d", score));
  1284. X      x += 25 * l_width(big_font);
  1285. X      (void) strcpy(buf, "AAA");
  1286. X  
  1287. X      for (len = 0; len < 3;) {
  1288. X!     pw_text(draw_win, x - len*l_width(big_font), y, 
  1289. X!         PIX_SRC|PIX_COLOR(TEXT_COLOR), big_font, buf);
  1290. X!     pw_char(draw_win, x, y, PIX_SRC|PIX_DST|PIX_COLOR(TEXT_COLOR), 
  1291. X!         big_font, '_');
  1292. X  
  1293. X      do window_read_event(Draw, &event);
  1294. X      while (event.ie_code == LOC_MOVE || event.ie_code == LOC_DRAG ||
  1295. X*** OLD/sparks.c    Mon Sep  7 18:55:05 1987
  1296. X--- sparks.c    Mon Mar  7 21:42:25 1988
  1297. X***************
  1298. X*** 35,43 ****
  1299. X   * move left-right or up-down the formula given finds which icon to use to
  1300. X   * to guarantee that it's not the last one used.
  1301. X   */
  1302. X! #define draw_spark(x, y)     \
  1303. X      pw_rop(draw_win, pen_coord_x(x), pen_coord_y(y), 16,16, \
  1304. X!     XOR, spark_icons[(x + y) & 3], 0,0)
  1305. X  
  1306. X  struct spark {
  1307. X      int x, y, oldx, oldy;
  1308. X--- 35,43 ----
  1309. X   * move left-right or up-down the formula given finds which icon to use to
  1310. X   * to guarantee that it's not the last one used.
  1311. X   */
  1312. X! #define draw_spark(x, y, color)     \
  1313. X      pw_rop(draw_win, pen_coord_x(x), pen_coord_y(y), 16,16, \
  1314. X!     XOR| PIX_COLOR(color), spark_icons[(x + y) & 3], 0,0)
  1315. X  
  1316. X  struct spark {
  1317. X      int x, y, oldx, oldy;
  1318. X***************
  1319. X*** 107,112 ****
  1320. X--- 107,113 ----
  1321. X      register int x, y, sp, move_clockwise, came_from, dir;
  1322. X      /* new spark x and y coord */
  1323. X  
  1324. X+     pw_putattributes(draw_win, &qix_mask);
  1325. X      for (sp = 0; sp < MAX_SPARKS; sp++) {
  1326. X      if (sparks[sp].x < 0)
  1327. X          break;
  1328. X***************
  1329. X*** 115,125 ****
  1330. X       * duced in pairs, the second spark will have the same coords and
  1331. X       * erase this mark. (clever, huh?)
  1332. X       */
  1333. X!     draw_spark(sparks[sp].x, sparks[sp].y);
  1334. X      x = sparks[sp].x, y = sparks[sp].y;
  1335. X      /* user bit the big one */
  1336. X      if (x == pen_x && y == pen_y) {
  1337. X!         draw_spark(sparks[sp].x, sparks[sp].y); /* redraw the spark */
  1338. X          change_life(DIE);
  1339. X          return -1;
  1340. X      }
  1341. X--- 116,128 ----
  1342. X       * duced in pairs, the second spark will have the same coords and
  1343. X       * erase this mark. (clever, huh?)
  1344. X       */
  1345. X!     draw_spark(sparks[sp].x, sparks[sp].y,
  1346. X!            aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
  1347. X      x = sparks[sp].x, y = sparks[sp].y;
  1348. X      /* user bit the big one */
  1349. X      if (x == pen_x && y == pen_y) {
  1350. X!         draw_spark(sparks[sp].x, sparks[sp].y,
  1351. X!            aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
  1352. X          change_life(DIE);
  1353. X          return -1;
  1354. X      }
  1355. X***************
  1356. X*** 157,163 ****
  1357. X          box(convert_x(x)-10, convert_y(y)-10,
  1358. X              convert_x(x)+10, convert_y(y)+10, XOR);
  1359. X          msg("HALT! infinite-loop police! [y] (%d, %d)", x, y);
  1360. X!         sleep(2);
  1361. X          remove_msgs(0);
  1362. X          box(convert_x(x)-10, convert_y(y)-10,
  1363. X              convert_x(x)+10, convert_y(y)+10, XOR);
  1364. X--- 160,166 ----
  1365. X          box(convert_x(x)-10, convert_y(y)-10,
  1366. X              convert_x(x)+10, convert_y(y)+10, XOR);
  1367. X          msg("HALT! infinite-loop police! [y] (%d, %d)", x, y);
  1368. X!         Sleep(2);
  1369. X          remove_msgs(0);
  1370. X          box(convert_x(x)-10, convert_y(y)-10,
  1371. X              convert_x(x)+10, convert_y(y)+10, XOR);
  1372. X***************
  1373. X*** 182,188 ****
  1374. X  
  1375. X      sparks[sp].oldx = sparks[sp].x, sparks[sp].oldy = sparks[sp].y;
  1376. X      /* draw the new spark */
  1377. X!     draw_spark(x, y);
  1378. X      sparks[sp].x = x, sparks[sp].y = y;
  1379. X  
  1380. X      if (x == pen_x && y == pen_y) {
  1381. X--- 185,191 ----
  1382. X  
  1383. X      sparks[sp].oldx = sparks[sp].x, sparks[sp].oldy = sparks[sp].y;
  1384. X      /* draw the new spark */
  1385. X!     draw_spark(x, y, aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
  1386. X      sparks[sp].x = x, sparks[sp].y = y;
  1387. X  
  1388. X      if (x == pen_x && y == pen_y) {
  1389. X***************
  1390. X*** 198,214 ****
  1391. X          /* give the only warning we can without a sound chip :-) */
  1392. X          fputc(7, stderr), fflush(stderr);
  1393. X          msg("Sparx are now aggressive.");
  1394. X!         sleep(2);
  1395. X          remove_msgs(0);
  1396. X          aggressive = 1;
  1397. X          }
  1398. X!         if (sp == MAX_SPARKS)
  1399. X          return 0; /* no sparks left to start, so don't do a countdown */
  1400. X      }
  1401. X!     start_spark(BOARD_WIDTH/2, 0, TRUE);
  1402. X!     start_spark(BOARD_WIDTH/2, 0, FALSE);
  1403. X!     draw(BORDER, 20, BOARD_WIDTH_IN_PIXELS-BORDER, 20, PIX_SRC);
  1404. X!     draw(BORDER, 21, BOARD_WIDTH_IN_PIXELS-BORDER, 21, PIX_SRC);
  1405. X      }
  1406. X      if (sp < MAX_SPARKS) {
  1407. X      /* calculate the percentage of the width of the board in pixels */
  1408. X--- 201,224 ----
  1409. X          /* give the only warning we can without a sound chip :-) */
  1410. X          fputc(7, stderr), fflush(stderr);
  1411. X          msg("Sparx are now aggressive.");
  1412. X!         Sleep(2);
  1413. X          remove_msgs(0);
  1414. X+         /* erase red sparks now or blue sparks will leave green */
  1415. X+         toggle_sparks();
  1416. X          aggressive = 1;
  1417. X+         /* now draw blue sparks */
  1418. X+         toggle_sparks();
  1419. X          }
  1420. X!         if (sp == MAX_SPARKS) {
  1421. X          return 0; /* no sparks left to start, so don't do a countdown */
  1422. X+         }
  1423. X      }
  1424. X!     start_spark(BOARD_WIDTH/2, 0);
  1425. X!     start_spark(BOARD_WIDTH/2, 0);
  1426. X!     draw(BORDER, 20, BOARD_WIDTH_IN_PIXELS-BORDER, 20, 
  1427. X!         PIX_SRC|PIX_COLOR(SPARKS_COLOR));
  1428. X!     draw(BORDER, 21, BOARD_WIDTH_IN_PIXELS-BORDER, 21, 
  1429. X!         PIX_SRC|PIX_COLOR(SPARKS_COLOR));
  1430. X      }
  1431. X      if (sp < MAX_SPARKS) {
  1432. X      /* calculate the percentage of the width of the board in pixels */
  1433. X***************
  1434. X*** 236,248 ****
  1435. X      static x = -1, y;
  1436. X      int n;
  1437. X  
  1438. X      if (x > -1)
  1439. X!     draw_spark(x, y);
  1440. X      if (!pos || !*pos) {
  1441. X      x = -1;
  1442. X      return 0;
  1443. X      }
  1444. X!     draw_spark((*pos)->x, (*pos)->y);
  1445. X      x = (*pos)->x, y = (*pos)->y;
  1446. X  
  1447. X      if ((*pos)->x == pen_x && (*pos)->y == pen_y) {
  1448. X--- 246,260 ----
  1449. X      static x = -1, y;
  1450. X      int n;
  1451. X  
  1452. X+     /* fuse is always red */
  1453. X+     pw_putattributes(draw_win, &qix_mask);
  1454. X      if (x > -1)
  1455. X!     draw_spark(x, y, SPARKS_COLOR);
  1456. X      if (!pos || !*pos) {
  1457. X      x = -1;
  1458. X      return 0;
  1459. X      }
  1460. X!     draw_spark((*pos)->x, (*pos)->y, SPARKS_COLOR);
  1461. X      x = (*pos)->x, y = (*pos)->y;
  1462. X  
  1463. X      if ((*pos)->x == pen_x && (*pos)->y == pen_y) {
  1464. X***************
  1465. X*** 263,272 ****
  1466. X  {
  1467. X      int n;
  1468. X  
  1469. X      /* for each spark, if active, make it go away and reset to -1 */
  1470. X      for (n = 0; n < MAX_SPARKS; n++)
  1471. X      if (sparks[n].x > -1) {
  1472. X!         draw_spark(sparks[n].x, sparks[n].y);
  1473. X          sparks[n].oldx = sparks[n].x = -1;
  1474. X      }
  1475. X      draw(BORDER, 20, BOARD_WIDTH_IN_PIXELS-BORDER, 20, PIX_CLR);
  1476. X--- 275,286 ----
  1477. X  {
  1478. X      int n;
  1479. X  
  1480. X+     pw_putattributes(draw_win, &qix_mask);
  1481. X      /* for each spark, if active, make it go away and reset to -1 */
  1482. X      for (n = 0; n < MAX_SPARKS; n++)
  1483. X      if (sparks[n].x > -1) {
  1484. X!         draw_spark(sparks[n].x, sparks[n].y,
  1485. X!             aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
  1486. X          sparks[n].oldx = sparks[n].x = -1;
  1487. X      }
  1488. X      draw(BORDER, 20, BOARD_WIDTH_IN_PIXELS-BORDER, 20, PIX_CLR);
  1489. X***************
  1490. X*** 282,290 ****
  1491. X  {
  1492. X      register int sp;
  1493. X  
  1494. X      for (sp = 0; sp < MAX_SPARKS; sp++) {
  1495. X      if (sparks[sp].x < 0)
  1496. X          break;
  1497. X!     draw_spark(sparks[sp].x, sparks[sp].y);
  1498. X      }
  1499. X  }
  1500. X--- 296,306 ----
  1501. X  {
  1502. X      register int sp;
  1503. X  
  1504. X+     pw_putattributes(draw_win, &qix_mask);
  1505. X      for (sp = 0; sp < MAX_SPARKS; sp++) {
  1506. X      if (sparks[sp].x < 0)
  1507. X          break;
  1508. X!     draw_spark(sparks[sp].x, sparks[sp].y,
  1509. X!         aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
  1510. X      }
  1511. X  }
  1512. END_OF_Patches01
  1513. if test 42908 -ne `wc -c <Patches01`; then
  1514.     echo shar: \"Patches01\" unpacked with wrong size!
  1515. fi
  1516. # end of overwriting check
  1517. fi
  1518. echo shar: End of shell archive.
  1519. exit 0
  1520.